﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10.NthCathalanNumbers
{
    class NthCathalanNumber
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Insert a positive integer number");
            decimal n = decimal.Parse(Console.ReadLine());
            decimal nominator = 1m,
                NthNumber = 0;
            decimal denominator = 1m;
            for (decimal i = 1; i <= 2 * n; i++)
            {
                nominator *= i;
            }
            for (decimal j = 1; j <=n; j++)
            {
                denominator *= j;
            }
            denominator = denominator * denominator * (n + 1);
            NthNumber = nominator / denominator;

            Console.WriteLine("nth number in Catalan sequence is equal to {0}", NthNumber);
        }
    }
}
